<template>
  <!--  营业收入统计-消费汇总 -->
  <div class="consumption">
    <el-table
      v-loading="loading"
      :data="detailslist"
      ref="table"
      border
      :header-cell-style="(header) => headFirst(header, 2)"
      highlight-current-row
      style="width: 100%"
      :cell-style="
        detailsTotal ? (res) => headFirst_col(res, detailslist) : () => {}
      "
    >
      <el-table-column
        prop="merchantName"
        label="结算单位"
        v-if="formThead.merchantName.checked"
        align="center"
      ></el-table-column>
      <el-table-column prop="Morning" label="早餐" v-if="formThead.Morning.checked" align="center">
        <el-table-column
          prop="expenditureMorning"
          label="金额(元)"
          v-if="formThead.expenditureMorning.checked"
          align="center"
          min-width="85px"
        >
          <template slot-scope="scope">
            <div>{{ scope.row.expenditureMorning | amountyuan }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="consumeCountMorning"
          label="消费次数"
          v-if="formThead.consumeCountMorning.checked"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="timesCountMorning"
          label="计次消费次数"
          v-if="formThead.timesCountMorning.checked"
          align="center"
          min-width="85px"
        ></el-table-column>
      </el-table-column>
      <el-table-column prop="Lunch" label="中餐" v-if="formThead.Lunch.checked" align="center">
        <el-table-column
          prop="expenditureLunch"
          label="金额(元)"
          v-if="formThead.expenditureLunch.checked"
          align="center"
          min-width="85px"
        >
          <template slot-scope="scope">
            <div>{{ scope.row.expenditureLunch | amountyuan }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="consumeCountLunch"
          label="消费次数"
          v-if="formThead.consumeCountLunch.checked"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="timesCountLunch"
          label="计次消费次数"
          v-if="formThead.timesCountLunch.checked"
          align="center"
          min-width="85px"
        ></el-table-column>
      </el-table-column>
      <el-table-column prop="Dinner" label="晚餐" v-if="formThead.Dinner.checked" align="center">
        <el-table-column
          prop="expenditureDinner"
          label="金额(元)"
          v-if="formThead.expenditureDinner.checked"
          align="center"
          min-width="85px"
        >
          <template slot-scope="scope">
            <div>{{ scope.row.expenditureDinner | amountyuan }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="consumeCountDinner"
          label="消费次数"
          v-if="formThead.consumeCountDinner.checked"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="timesCountDinner"
          label="计次消费次数"
          v-if="formThead.timesCountDinner.checked"
          align="center"
          min-width="85px"
        ></el-table-column>
      </el-table-column>
      <el-table-column prop="Night" label="夜宵" v-if="formThead.Night.checked" align="center">
        <el-table-column
          prop="expenditureNight"
          label="金额(元)"
          v-if="formThead.expenditureNight.checked"
          align="center"
          min-width="85px"
        >
          <template slot-scope="scope">
            <div>{{ scope.row.expenditureNight | amountyuan }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="consumeCountNight"
          label="消费次数"
          v-if="formThead.consumeCountNight.checked"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="timesCountNight"
          label="计次消费次数"
          v-if="formThead.timesCountNight.checked"
          align="center"
          min-width="85px"
        ></el-table-column>
      </el-table-column>
      <!-- <el-table-column
        prop="Other"
        label="其余时间"
        v-if="formThead.Other.checked"
        align="center"
      >
        <el-table-column
          prop="expenditureOther"
          label="金额(元)"
          v-if="formThead.expenditureOther.checked"
          align="center"
          min-width="85px"
        >
          <template slot-scope="scope">
            <div>{{ scope.row.expenditureOther | amountyuan }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="consumeCountOther"
          label="消费次数"
          v-if="formThead.consumeCountOther.checked"
          align="center"
        ></el-table-column>
      </el-table-column>-->
      <el-table-column prop="Revise" label="消费修正" v-if="formThead.Revise.checked" align="center">
        <el-table-column
          prop="consumeReviseSum"
          label="金额(元)"
          v-if="formThead.consumeReviseSum.checked"
          align="center"
          min-width="85px"
        >
          <template slot-scope="scope">
            <div>{{ scope.row.consumeReviseSum | amountyuan }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="consumeReviseCount"
          label="修正次数"
          v-if="formThead.consumeReviseCount.checked"
          align="center"
        ></el-table-column>
      </el-table-column>
      <el-table-column prop="Sum" label="小计" v-if="formThead.Sum.checked" align="center">
        <el-table-column
          prop="expenditureSum"
          label="金额(元)"
          v-if="formThead.expenditureSum.checked"
          align="center"
          min-width="85px"
        >
          <template slot-scope="scope">
            <div>{{ scope.row.expenditureSum | amountyuan }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="consumeCountSum"
          label="消费次数"
          v-if="formThead.consumeCountSum.checked"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="timesCountSum"
          label="计次消费次数"
          v-if="formThead.timesCountSum.checked"
          align="center"
          min-width="85px"
        ></el-table-column>
      </el-table-column>
    </el-table>
    <div class="page">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChangepage"
        :current-page="currentPage"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="recordCount"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import bus from '@/bus.js'
export default {
  data() {
    return {
      filename: '消费汇总',
      loading: false,
      exportlist: [],
      // 合计数据
      detailsTotal: null,
      // 数据
      detailslist: [],
      pageNum: 1,
      pageSize: 20,
      currentPage: 1,
      recordCount: 0,
      searchInfo: {},
      tHeadercshie: [
        [
          '结算',
          '早餐',
          '',
          '中餐',
          '',
          '晚餐',
          '',
          '夜宵',
          '',
          // "其余时间",
          // "",
          '小计',
          ''
        ]
      ],
      //消费汇总
      formThead: {
        merchantName: {
          label: '结算单位',
          prop: 'merchantName',
          checked: true
        },
        Morning: { label: '早餐', prop: 'Morning', checked: true },
        Lunch: { label: '中餐', prop: 'Lunch', checked: true },
        Dinner: { label: '晚餐', prop: 'Dinner', checked: true },
        Night: { label: '夜宵', prop: 'Night', checked: true },
        // Other: { label: "其余时间", prop: "Other", checked: true },
        Revise: { label: '消费修正', prop: 'Revise', checked: true },
        Sum: { label: '小计', prop: 'Sum', checked: true },

        expenditureMorning: {
          label: '金额',
          prop: 'expenditureMorning',
          checked: true
        },
        consumeCountMorning: {
          label: '消费次数',
          prop: 'consumeCountMorning',
          checked: true
        },
        timesCountMorning: {
          label: '计次消费次数',
          prop: 'timesCountMorning',
          checked: true
        },

        expenditureLunch: {
          label: '金额',
          prop: 'expenditureLunch',
          checked: true
        },
        consumeCountLunch: {
          label: '消费次数',
          prop: 'consumeCountLunch',
          checked: true
        },
        timesCountLunch: {
          label: '计次消费次数',
          prop: 'timesCountLunch',
          checked: true
        },

        expenditureDinner: {
          label: '金额',
          prop: 'expenditureDinner',
          checked: true
        },
        consumeCountDinner: {
          label: '消费次数',
          prop: 'consumeCountDinner',
          checked: true
        },
        timesCountDinner: {
          label: '计次消费次数',
          prop: 'timesCountDinner',
          checked: true
        },
        expenditureNight: {
          label: '金额',
          prop: 'expenditureNight',
          checked: true
        },
        consumeCountNight: {
          label: '消费次数',
          prop: 'consumeCountNight',
          checked: true
        },
        timesCountNight: {
          label: '计次消费次数',
          prop: 'timesCountNight',
          checked: true
        },
        expenditureOther: {
          label: '金额',
          prop: 'expenditureOther',
          checked: true
        },
        consumeCountOther: {
          label: '消费次数',
          prop: 'consumeCountOther',
          checked: true
        },
        timesCountOther: {
          label: '计次消费次数',
          prop: 'timesCountOther',
          checked: true
        },
        consumeReviseSum: {
          label: '金额',
          prop: 'consumeReviseSum',
          checked: true
        },
        consumeReviseCount: {
          label: '修正次数',
          prop: 'consumeReviseCount',
          checked: true
        },

        expenditureSum: {
          label: '金额',
          prop: 'expenditureSum',
          checked: true
        },
        consumeCountSum: {
          label: '金额',
          prop: 'consumeCountSum',
          checked: true
        },
        timesCountSum: {
          label: '计次消费次数',
          prop: 'timesCountSum',
          checked: true
        }
      }
    }
  },
  mounted() {
    bus.$on('listenToA', this.getHeaderDate)
    this.ceshi()
  },
  props: [
    'datetime',
    'unitGuid',
    'consumptionpoint',
    'radio',
    'consumermachine'
  ],
  methods: {
    // 获取合计数据
    getTotal() {
      let _this = this
      _this.loading = true
      return new Promise(function(resolve, reject) {
        _this
          .$http({
            url: _this.$http.adornUrl(
              '/terminal/consume/consume-statistics-total'
            ),
            method: 'post',
            data: _this.$http.adornData({
              messageContent: _this.searchInfo,
              messageType: 0
            })
          })
          .then(({ data }) => {
            _this.loading = false
            if (data.messageCode == 200) {
              resolve(data.messageContent)
            } else {
              reject(data.errorMessage)
              this.$message.error(data.errorMessage)
            }
          })
      })
    },
    // 消费汇总初始化
    async gestatistics() {
      this.pageNum = 1
      if (this.datetime == null) {
        this.searchInfo.startTime = ''
        this.searchInfo.endTime = ''
      } else {
        this.searchInfo.startTime = this.datetime[0]
        this.searchInfo.endTime = this.datetime[1]
      }
      this.searchInfo.unitGuid = this.unitGuid
      this.searchInfo.merchantGuidList = this.consumptionpoint
      if (this.radio == 0) {
        this.searchInfo.timeType = 0
      } else if (this.radio == 1) {
        this.searchInfo.timeType = 1
      } else {
        this.searchInfo.timeType = 2
      }
      this.searchInfo.terminalCodeList = this.consumermachine
      this.detailsTotal = null
      this.detailsTotal = await this.getTotal()
      await this.gestatisticsSeek()
      // this.detailslist.push(this.total);
    },
    // 消费汇总查询
    gestatisticsSeek() {
      let _this = this
      return new Promise(function(resolve, reject) {
        _this.loading = true
        _this
          .$http({
            url: _this.$http.adornUrl(
              '/terminal/consume/consume-statistics-page'
            ),
            method: 'post',
            data: _this.$http.adornData({
              messageContent: {
                pageNum: _this.pageNum,
                pageSize: _this.pageSize,
                searchInfo: _this.searchInfo
              },
              messageType: 0
            })
          })
          .then(({ data }) => {
            _this.loading = false
            if (data.messageCode == 200) {
              if (
                data.messageContent.data.length == 0 ||
                data.messageContent.data == null
              ) {
                _this.$message({
                  message: '查询成功当前暂无数据',
                  type: 'success'
                })
              }
              resolve(data.messageContent.data)
              _this.detailslist = data.messageContent.data
              _this.recordCount = data.messageContent.recordCount
              _this.currentPage = data.messageContent.pageNum
              // 将合计数据添加到最后一行
              if (_this.detailsTotal && _this.detailslist.length) {
                _this.detailslist.push(_this.detailsTotal)
              }
            } else {
              reject(data.errorMessage)
              _this.$message.error(data.errorMessage)
            }
          })
      })
    },
    handleSizeChange(val) {
      this.pageSize = val
      this.gestatisticsSeek()
    },
    handleCurrentChangepage(val) {
      this.pageNum = val
      this.gestatisticsSeek()
    },
    getHeaderDate(val) {
      this.$nextTick(() => {
        this.$refs['table'].doLayout()
      })
      this.formThead = val
    },
    ceshi() {
      //   this.tHeadercshie[0].splice(1,2)
      console.log(this.tHeadercshie[0].length)
    },
    // 打印和导出函数
    async export(type) {
      // console.log(this.formThead)

      if (this.detailslist.length == 0) {
        this.$message({
          message: '请查询数据后,在进行此操作',
          type: 'warning'
        })
        return false
      }
      if (this.datetime == null) {
        this.searchInfo.startTime = ''
        this.searchInfo.endTime = ''
      } else {
        this.searchInfo.startTime = this.datetime[0]
        this.searchInfo.endTime = this.datetime[1]
      }
      this.searchInfo.unitGuid = this.unitGuid
      if (this.radio == 0) {
        this.searchInfo.timeType = 0
      } else if (this.radio == 1) {
        this.searchInfo.timeType = 1
      } else {
        this.searchInfo.timeType = 2
      }
      let arr = await this.outexecel()
      if (type == 'print') {
        this.printJS(arr)
      } else {
        this.export2Excel(arr)
      }
    },
    // 所有消费汇总数据获取
    outexecel() {
      let _this = this
      return new Promise(function(resolve, reject) {
        _this
          .$http({
            url: _this.$http.adornUrl(
              '/terminal/consume/consume-statistics-page'
            ),
            method: 'post',
            data: _this.$http.adornData({
              messageContent: {
                pageNum: 1,
                pageSize: _this.recordCount,
                searchInfo: _this.searchInfo
              },
              messageType: 0
            })
          })
          .then(({ data }) => {
            _this.loading = false
            if (data.messageCode == 200) {
              _this.exportlist = data.messageContent.data
              if (_this.detailsTotal && data.messageContent.data.length) {
                _this.exportlist.push(_this.detailsTotal)
              }
              // 分转元
              let arr = [
                'expenditureMorning',
                'expenditureLunch',
                'expenditureDinner',
                'expenditureNight',
                'expenditureOther',
                'expenditureSum',
                'consumeReviseSum'
              ]
              let objArr = JSON.parse(JSON.stringify(_this.exportlist))
              objArr.map(item => {
                arr.map(key => {
                  item[key] = _this.amountyua(item[key])
                })
              })
              resolve(objArr)
            } else {
              reject(data.errorMessage)
              _this.$message.error(data.errorMessage)
            }
          })
      })
    },
    // 打印相关
    printJS(arr) {
      let someJSONdata = arr
      const title = '消费汇总报表'
      this.unitName = sessionStorage.getItem('unitName')
      this.loginName = sessionStorage.getItem('username')
      const properties = []
      if (this.formThead.merchantName.checked == true) {
        properties.push({
          displayName: '结算单位',
          field: 'merchantName',
          columnSize: '8%',
          // 需要合并的话，这个字段必填
          columnNo: true
        })
      }
      if (this.formThead.Morning.checked == true) {
        properties.push({
          displayName: '早餐',
          field: 'Morning',
          sonProperties: [
            { displayName: '金额(元)', field: 'expenditureMorning' },
            { displayName: '消费次数', field: 'consumeCountMorning' },
            { displayName: '计次消费次数', field: 'timesCountMorning' }
          ]
        })
      }
      if (this.formThead.Lunch.checked == true) {
        properties.push({
          displayName: '中餐',
          field: 'Lunch',
          sonProperties: [
            { displayName: '金额(元)', field: 'expenditureLunch' },
            { displayName: '消费次数', field: 'consumeCountLunch' },
            { displayName: '计次消费次数', field: 'timesCountLunch' }
          ]
        })
      }
      if (this.formThead.Dinner.checked == true) {
        properties.push({
          displayName: '晚餐',
          field: 'Dinner',
          sonProperties: [
            { displayName: '金额(元)', field: 'expenditureDinner' },
            { displayName: '消费次数', field: 'consumeCountDinner' },
            { displayName: '计次消费次数', field: 'timesCountDinner' }
          ]
        })
      }
      if (this.formThead.Night.checked == true) {
        properties.push({
          displayName: '夜宵',
          field: 'Night',
          sonProperties: [
            { displayName: '金额(元)', field: 'expenditureNight' },
            { displayName: '消费次数', field: 'consumeCountNight' },
            { displayName: '计次消费次数', field: 'timesCountNight' }
          ]
        })
      }

      if (this.formThead.Revise.checked == true) {
        properties.push({
          displayName: '消费修正',
          field: 'Revise',
          sonProperties: [
            { displayName: '金额(元)', field: 'consumeReviseSum' },
            { displayName: '修正次数', field: 'consumeReviseCount' }
          ]
        })
      }
      // if (this.formThead.Other.checked == true) {
      //   properties.push({
      //     displayName: "其余时间",
      //     field: "Other",
      //     sonProperties: [
      //       { displayName: "金额(元)", field: "expenditureOther" },
      //       { displayName: "消费次数", field: "consumeCountOther" },
      //     ],
      //   });
      // }
      if (this.formThead.Sum.checked == true) {
        properties.push({
          displayName: '小计',
          field: 'Sum',
          sonProperties: [
            { displayName: '金额(元)', field: 'expenditureSum' },
            { displayName: '消费次数', field: 'consumeCountSum' },
            { displayName: '计次消费次数', field: 'timesCountSum' }
          ]
        })
      }
      // 打印
      this.$printJS({
        // 眉头
        documentTitle: `${this.unitName}`,
        /**
         * 获取表头的信息
         * @param {*} title 表名
         * @param {*} unitName 单位
         * @param {*} time 时间
         */
        header: this.printHeader(
          title,
          this.unitName,
          `${this.formatDate(
            new Date(this.searchInfo.startTime),
            'yyyy-MM-dd'
          )} 至 ${this.formatDate(
            new Date(this.searchInfo.endTime),
            'yyyy-MM-dd'
          )}`
        ),
        printable: someJSONdata,
        properties: properties,
        type: 'json',
        // 是否每页都显示头部
        // repeatTableHeader:false,
        headerRow: 2,
        /**
         * 获取页脚的信息
         * @param {*} loginName 制表人：
         * @param {*} time 时间
         */
        endPage: this.printFloor(
          this.loginName,
          this.getNowTime('yy-mm-dd hh:mm:ss')
        ),
        //  获取页脚的信息样式
        style: this.printFloorStyle()
      })
    },
    // 导出相关
    formatJson(filterVal, jsonData) {
      return jsonData.map(v =>
        filterVal.map(j => {
          if (j === 'timestamp') {
            return parseTime(v[j])
          } else {
            return v[j]
          }
        })
      )
    },
    export2Excel(objArr) {
      const nowtime = this.getimeto()
      require.ensure([], () => {
        let multiHeader = [[]]
        let multiHeader2 = [[]]

        let tHeader = []
        let merges1 = [
          'A1:A2',
          'B1:D1',
          'E1:G1',
          'H1:J1',
          'K1:M1',
          'N1:O1',
          'P1:R1'
        ]
        let merges2 = ['A1:C1', 'D1:F1', 'G1:I1', 'J1:L1', 'M1:N1', 'O1:Q1']
        let merges = []

        // merchantName: {label: '结算单位',prop: 'merchantName',checked:true},
        // Morning: {label: '早餐',prop: 'Morning',checked:true},
        // Lunch: {label: '中餐',prop: 'Lunch',checked:true},
        // Dinner: {label: '晚餐',prop: 'Dinner',checked:true},
        // Night: {label: '夜宵',prop: 'Night',checked:true},
        // Other: {label: '其余时间',prop: 'Other',checked:true},
        // Sum: {label: '小计',prop: 'Sum',checked:true},
        let filterValArr = []
        // [
        //         "结算",
        //         "早餐",
        //         "",
        //         "中餐",
        //         "",
        //         "晚餐",
        //         "",
        //         "夜宵",
        //         "",
        //         "其余时间",
        //         "",
        //         "小计",
        //         ""
        //     ]
        //  [
        //     // "结算",

        //     // "消费次数",
        //     // "金额(元)",

        //     // "消费次数",
        //     // "金额(元)",

        //     // "消费次数",
        //     // "金额(元)",

        //     // "消费次数",
        //     // "金额(元)",

        //     // "消费次数",
        //     // "金额(元)",

        //     // "消费次数",
        //     // "金额(元)",

        //    ]
        if (this.formThead.merchantName.checked == true) {
          filterValArr.push(this.formThead.merchantName.prop)
          multiHeader2[0].push('结算单位')
          tHeader.push('结算单位')
          merges = merges1
        } else {
          merges = merges2
        }

        if (this.formThead.Morning.checked == true) {
          multiHeader2[0].push('早餐', '', "")
          tHeader.push('金额(元)', '消费次数', '计次消费次数')
        } else {
          merges.splice(merges.length - 1, 1)
        }
        if (this.formThead.Lunch.checked == true) {
          multiHeader2[0].push('中餐', '', "")
          tHeader.push('金额(元)', '消费次数', '计次消费次数')
        } else {
          merges.splice(merges.length - 1, 1)
        }
        if (this.formThead.Dinner.checked == true) {
          multiHeader2[0].push('晚餐', '', "")
          tHeader.push('金额(元)', '消费次数', '计次消费次数')
        } else {
          merges.splice(merges.length - 1, 1)
        }
        if (this.formThead.Night.checked == true) {
          multiHeader2[0].push('夜宵', '', "")
          tHeader.push('金额(元)', '消费次数', '计次消费次数')
        } else {
          merges.splice(merges.length - 1, 1)
        }
        // if (this.formThead.Other.checked == true) {
        //   multiHeader2[0].push("其余时间", "");
        //   tHeader.push("金额(元)", "消费次数");
        // } else {
        //   merges.splice(merges.length - 1, 1);
        // }
        if (this.formThead.Revise.checked == true) {
          multiHeader2[0].push('消费修正', '')
          tHeader.push('金额(元)', '修正次数')
        } else {
          merges.splice(merges.length - 1, 1)
        }
        if (this.formThead.Sum.checked == true) {
          multiHeader2[0].push('小计', '', "")
          tHeader.push('金额(元)', '消费次数', '计次消费次数')
        } else {
          merges.splice(merges.length - 1, 1)
        }

        //  Morning: {label: '早餐',prop: 'Morning',checked:true},
        // Lunch: {label: '中餐',prop: 'Lunch',checked:true},
        // Dinner: {label: '晚餐',prop: 'Dinner',checked:true},
        // Night: {label: '夜宵',prop: 'Night',checked:true},
        // Other: {label: '其余时间',prop: 'Other',checked:true},
        // Sum: {label: '小计',prop: 'Sum',checked:true},

        if (this.formThead.Morning.checked == true) {
          filterValArr.push(this.formThead.expenditureMorning.prop)
        }
        if (this.formThead.Morning.checked == true) {
          filterValArr.push(this.formThead.consumeCountMorning.prop)
        }
         if (this.formThead.Morning.checked == true) {
          filterValArr.push(this.formThead.timesCountMorning.prop)
        }
        if (this.formThead.Lunch.checked == true) {
          filterValArr.push(this.formThead.expenditureLunch.prop)
        }
        if (this.formThead.Lunch.checked == true) {
          filterValArr.push(this.formThead.consumeCountLunch.prop)
        }
         if (this.formThead.Lunch.checked == true) {
          filterValArr.push(this.formThead.timesCountLunch.prop)
        }

        if (this.formThead.Dinner.checked == true) {
          filterValArr.push(this.formThead.expenditureDinner.prop)
        }
        if (this.formThead.Dinner.checked == true) {
          filterValArr.push(this.formThead.consumeCountDinner.prop)
        }
        if (this.formThead.Dinner.checked == true) {
          filterValArr.push(this.formThead.timesCountDinner.prop)
        }

        if (this.formThead.Night.checked == true) {
          filterValArr.push(this.formThead.expenditureNight.prop)
        }
        if (this.formThead.Night.checked == true) {
          filterValArr.push(this.formThead.consumeCountNight.prop)
        }
        if (this.formThead.Night.checked == true) {
          filterValArr.push(this.formThead.timesCountNight.prop)
        }

        if (this.formThead.Revise.checked == true) {
          filterValArr.push(this.formThead.consumeReviseSum.prop)
        }
        if (this.formThead.Revise.checked == true) {
          filterValArr.push(this.formThead.consumeReviseCount.prop)
        }
        // if (this.formThead.Other.checked == true) {
        //   filterValArr.push(this.formThead.expenditureOther.prop);
        // }
        // if (this.formThead.Other.checked == true) {
        //   filterValArr.push(this.formThead.consumeCountOther.prop);
        // }
        if (this.formThead.Sum.checked == true) {
          filterValArr.push(this.formThead.expenditureSum.prop)
        }
        if (this.formThead.Sum.checked == true) {
          filterValArr.push(this.formThead.consumeCountSum.prop)
        }
        if (this.formThead.Sum.checked == true) {
          filterValArr.push(this.formThead.timesCountSum.prop)
        }

        const { export_json_to_excel } = require('../../excel/Export2Excel')
        const filterVal = filterValArr
        const list = objArr
        const data = this.formatJson(filterVal, list)
        export_json_to_excel({
          multiHeader2, //这里是第二行的表头
          header: tHeader,
          data,
          merges,
          filename: this.filename + nowtime,
          tableheader: '2'
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.consumption {
  //滚动条的宽度
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  //滚动条的滑块
  ::-webkit-scrollbar-thumb {
    background-color: #a1a3a9;
    border-radius: 3px;
  }
}
.page {
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>